<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="新增ERP人事借款申请" bodyClass="white-bg"  libs=["prism","bootstrapSelect","ueditor"]/>
<div class="wrapper wrapper-content ibox-content">
    <@form.form id="form-loan-add"  class="form-horizontal">
    <input name="applyUserid" value="${user.id}" class="form-control" type="hidden">
    <input name="serialNumber" value="${serNumber}" class="form-control" type="hidden">
    <div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "申请人"/>：
       </label>
        <div class="col-sm-8"><input name="applyUsername" value="${user.name}" class="form-control" type="text" readonly="true">
        </div>
     </div>
    <div class="form-group">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "原因"/>：                                                  
       </label>
        <div class="col-sm-8"><input name="moneyReason" class="form-control" type="text"  required>
        </div>
     </div>
    <div class="form-group">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "金额"/>：                                                  
       </label>
        <div class="col-sm-8"><input name="moneyMoney" class="form-control" type="number"  required>
        </div>
     </div>
    <div class="form-group">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "证明"/>：                                                  
       </label>
        <div class="col-sm-8">

            <div class="layui-upload">
                <button type="button" class="btn btn-success btn-sm" id="proofList"><i class="fa fa-upload"></i> 上传证明</button>
                <div class="layui-upload-list layui-upList-minHeight uploadpadding">
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th>文件名</th>
                            <th>大小</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="demoproofList">
                        </tbody>
                    </table>
                </div>
                <div class="layui-form-item layui-btn-Center">
                    <div class="layui-input-block text-right">
                        <button type="button" class="layui-btn layui-btn-xs" id="proofListAction">开始上传</button>
                    </div>
                </div>
            </div>

        </div>
     </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "款项信息备注"/>：</label>
        <div class="col-sm-8">
            <textarea name="moneyMemo" class="form-control" required></textarea>
        </div>
    </div>
               
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "还款方式"/>：</label>
        <div class="col-sm-8">
            <@form.select name="moneyRepaymentMethod" dictType="sys_erp_paybackmethod" value="${bpmErpPersonLoan.moneyRepaymentMethod?default('1')}"   required="true"  />
        </div>
    </div>
    <div class="form-group">        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "还款期限"/>：                                                  
       </label>
        <div class="col-sm-8"><input name="moneyRepaymentTerm" class="form-control" type="text"  required>
        </div>
     </div>
 </@form.form>
</div>
<@footer>
    <script type="text/javascript">
        var prefix = baseURL + "erp/loan"
        $("#form-loan-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if (opt.validate.form()) {
                opt.operate.save(prefix + "/add", $('#form-loan-add').serialize());
            }
        }
        //在插件中使用对象
        $.fn.upfile = function(type) {
            var upfile = new Upfile(this,'',$("input[name='serialNumber']").val(),type);
            layui.use('upload', function() {
                var upload = layui.upload;
                var UplodeIn = upload.render(upfile.options);
                upfile.SetInst(UplodeIn)

            });

        };
        /**
         * 凭证
         */
        $('#proofList').upfile(9);
</script>
</@footer>
</@pageTheme>